#include <iostream>

using namespace std;

static bool palindrome(int num) {
    int reversed = 0;
    int original = num;

    while (num) {
        reversed = reversed * 10 + num % 10;
        num /= 10;
    }

    return original == reversed;
}

int main() {
    int max = 0;
    for (auto i = 100; i < 1000; ++i) {
        for (auto j = 100; j < 1000; ++j) {
            auto product = i * j;
            if (palindrome(product) && product > max)
                max = product;
        }
    }
    cout << max << endl;
}